package com.cskaoyan.bean.promotion.topic;

import com.cskaoyan.util.DateUtils;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description:
 * @Author: WD created on 2021-09-17 19:39
 * @Version:
 */
@NoArgsConstructor
@Data
public class UpdateTopicVO {

    private Integer id;
    private String title;
    private String subtitle;
    private Double price;
    private String readCount;
    private String picUrl;
    private Integer sortOrder;
    private Integer[] goods;
    private String addTime;
    private String updateTime;
    private Boolean deleted;
    private String content;


    public UpdateTopicVO(Topic topic) {
        this.id = topic.getId();
        this.title = topic.getTitle();
        this.subtitle = topic.getSubtitle();
        this.price = topic.getPrice().doubleValue();
        this.readCount = topic.getReadCount();
        this.picUrl = topic.getPicUrl();
        this.sortOrder = topic.getSortOrder();
        this.goods = topic.getGoods();
        if (topic.getAddTime() != null) {
            this.addTime = DateUtils.dateFormat(topic.getAddTime());
        }
        if (topic.getUpdateTime() != null) {
            this.updateTime = DateUtils.dateFormat(topic.getUpdateTime());
        }
        this.deleted = topic.getDeleted();
        this.content = topic.getContent();


    }
}
